#include <windows.h>
#include <iostream>
#include <process.h>
#include <conio.h>
#include<string>
using namespace std;

struct Param
{
	string name;
	bool escape;
};

void Thread_1(void * param){

	//char ch = (char)param;
	Param * data = (Param*)param;
	while(!data->escape){
		cout << data->name << "  ";
		Sleep(1000);
	}

	_endthread();
}

void main(){
	static Param param ;
	param.escape = false;
	param.name = 'A';
	char choice;
	//_beginthread(Thread_1, 0, (void*)'A');

	_beginthread(Thread_1, 0, (void*)&param);


	while(true){
		cout << "Do you want to break child thread?" << endl;
		//cin >> choice;
		choice = _getch();
		param.escape = (choice == 'y');
		Sleep(50);
	}
	_getch();

}